﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Conventions;
using FluentNHibernate.Mapping;
using Web.App.Infrastructure.NHibernate.Tools;

namespace Webshop20.Infrastructure.Persistence.NH.AutoMappings.Conventions.Common
{
    public class TableNameConvention : IClassConvention
    {
        public bool Accept(IClassMap target)
        {
            if (ClassIs.Excluded(target.EntityType.Name))
                return false;
            return true;
        }

        public void Apply(IClassMap target)
        {
            target.WithTable(Inflector.Pluralize(target.EntityType.Name));
        }
    }
}